﻿@namespace BootstrapBlazor.Components
@inherits ComponentBase

<PopUp IsOpen="IsOpen" Cancellation="Cancellation" Title="@Title" RenderBody="RenderBody">
    <RenderComponent>
        @if (RenderComponent is { })
        {
            @RenderComponent(context)
        }
        else
        {
            <ModelDialog IsOpen="true">
                <Card>
                    <HeaderTemplate>
                        <Center>
                            <div>@context.Title</div>
                        </Center>
                    </HeaderTemplate>
                    <BodyTemplate>
                        @context.RenderBody
                    </BodyTemplate>
                    <FooterTemplate>
                        @context.RenderFooter(context.Cancellation)
                    </FooterTemplate>
                </Card>
            </ModelDialog>
        }
    </RenderComponent>
    <RenderFooter>
        @if (RenderFooter is { })
        {
            @RenderFooter(context)
        }
        else
        {
            <div class="compactCentered">
                <Button Text="取消" OnClick="@context" />
            </div>
        }
    </RenderFooter>
</PopUp>